package com.yuma.redissondemo.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfig {

    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        // 配置redis地址，工作模式：单机模式，集群模式，主从模式，哨兵模式，备份模式
        config.useSingleServer()
                .setAddress("redis://192.168.6.104:6379")
                .setDatabase(0);
        return Redisson.create(config);
    }
}
